<?php
	include_once(SYSTEM.'/Model.php');
	include_once(SYSTEM.'/StringLengthRule.php');
	include_once(SYSTEM.'/RequiredRule.php');
	
	class CreateNewModel extends Model 
	{
		public $Name;
		public $Category;
		public $Province;
		public $City;
		public $Street;
		public $Description;
		public $Image;

		public function __construct($params) 
		{			
			$this->Name = $params['Name'];
			$this->CategoryID = $params['Category'];
			if (isset($params['Province'])) $this->Province = $params['Province'];
			if (isset($params['City'])) $this->City = $params['City'];
			if (isset($params['Street'])) $this->Street = $params['Street'];
			if (isset($params['Description'])) $this->Description = $params['Description'];
			if (isset($params['UploadImage'])) $this->Image = $_FILES['UploadImage'];
			
			$this->AddRules('Name', new RequiredRule('The Name field is required'));
			$this->AddRules('Street', new RequiredRule('The Street field is required'));
		}	
	}	